;
layui.define([ "table", "form" ], function(exports) {
	tab = layui.table, form = layui.form;
	tab.render({
		elem : "#LAY-web-list",
		url : layui.setter.base + "admin/contacts/listJson",
		cols : [ [
            {
                field : "merchName",
                title : "钱包用户"
            }, {
			field : "merchCode",
			title : "钱包编号"
		}, {
			field : "accountType",
			title : "账户类型",
			templet:function(data){return data.accountType == "bankCard" ? "银行卡":"钱包"}
		},{
			field : "isSelf",
			title : "账户所属",
			templet:function(data){return data.isSelf == true ? "本人卡":"他人卡"}
		},{
			field : "alias",
			title : "账户别名"
		},{
			field : "accountName",
			title : "开户名称"
		}, {
			field : "accountNo",
			title : "银行卡号"
		}, {
			field : "bankName",
			title : "银行名称"
		}, {
			field : "isStop",
			title : "状态",
			templet:function(data){return data.isStop?"禁用":"启用"}
		}, {
			title : "操作",
			width : 150,
			align : "center",
			fixed : "right",
			toolbar : "#table-content-list"
		} ] ],
		page : !0,
		limit : 10,
		limits : [ 10, 15, 20, 25, 30 ],
		text: {none: '暂无相关数据'}
	}), tab.on("tool(LAY-web-list)", function(row) {
		if ("update" === row.event) {
			parent.layer.open({
				type : 2,
				title : "编辑配置",
				content : layui.setter.base + "admin/contacts/updatePage?id="
						+ row.data.id,
				maxmin : !0,
				area : [ '80%', '90%' ],
				btn : [ "确定", "取消" ],
				yes : function(index, layero) {
					// 点击确认触发 iframe 内容中的按钮提交
					layero.find('iframe').contents().find(
							"#layuiadmin-app-form-edit").click();
				}
			});
			return;
		}

		if ("delete" === row.event) {
			layer.confirm("确定删除吗？", function(e) {
				console.log(row.data);
				// 请求删除接口
				layui.admin.req({
					url : layui.setter.base + "admin/contacts/delete?id="
							+ row.data.id + "&r=" + Math.random(),
					data : null,
					done : function(res) {
						if (res.code !== 0) {
							layer.msg(res.msg, {
								icon : 2
							});
						} else {
							layer.msg(res.msg, {
								icon : 1
							});
							layui.table.reload('LAY-web-list'); // 重载表格
							layer.close(e); // 再执行关闭
						}
					}
				});
			});
			return;
		}
	}), exports("contacts", {})
});
